<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/shop/addShoping.js"></script>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/swiper/swiper-3.3.1.min.css">
    <script src="${ctx}/libjs/plugins/swiper/swiper-3.3.1.jquery.min.js"></script>

</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>商品管理</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>新增商品</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });

</script>
<style>
    .content_left {
        display: inline-block;
        width: 50%;
    }

    .content_right {
        display: inline-block;
        width: 40%;
        vertical-align: top;
        margin-left: 100px;
    }

    .swiper-wrapper .swiper-slide img {
        width: 100%;
    }

</style>
<body class="gray-bg">

<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">

                    <div class="ibox-tools">
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <div class="content_left">
                        <%--                        enctype="multipart/form-data"--%>
                        <form class="form-horizontal m-t" id="addshoppic">
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">商品名称</label>

                                <div class="col-sm-4">
                                    <input class="form-control" id="shopName" name="goodsName" placeholder="商品名称">
                                </div>
                                <span style="color: gray">最多支持10个汉字</span>
                                <%--                        <div class="col-sm-1">--%>
                                <%--                            <button class="btn btn-primary" id="selectMemberAndAccountByMobile">查询</button>--%>
                                <%--                        </div>--%>
                            </div>
                            <%--                            <input type="hidden" name="memberId" id="memberId">--%>
                            <%--                            <input type="hidden" name="allAmount" id="allAmount">--%>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">商品属性</label>
                                <div class="col-sm-4">
                                    <select class="form-control" name="classType">
                                        <option value="0">实物商品</option>
                                        <option value="1"
                                                <c:if test="${tenantTransfer.transferType == '1'}">hidden</c:if>  >虚拟商品
                                        </option>
                                        <option value="2"
                                                <c:if test="${tenantTransfer.transferType == '1'}">hidden</c:if>  >第三方商品
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">兑换方式</label>
                                <div class="col-sm-4">
                                    <select class="form-control" name="salePlatform">
                                        <option value="2">快递邮寄</option>
                                        <option value="0"
                                                <c:if test="${tenantTransfer.transferType == '1'}">hidden</c:if>  >线上发放
                                        </option>
                                        <option value="1"
                                                <c:if test="${tenantTransfer.transferType == '1'}">hidden</c:if>  >线下兑换
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">关联优惠券</label>
                                <div class="col-sm-4">
                                    <select class="form-control" name="ticketTypeId" id="ticketTypeId">
                                        <option value>优惠券列表</option>
                                    </select>
                                </div>
                                <div>如果您的商品为平台优惠券，请在此处选择</div>
                            </div>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right"></label>
                                <div class="col-sm-4 dataType">

                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">积分单价</label>
                                <div class="col-sm-4">
                                    <input class="form-control" id="UnitPrice" name="goodsPoint">
                                </div>

                            </div>

                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">实际单价</label>
                                <div class="col-sm-4">
                                    <input id="moneyPay" class="form-control" name="goodsPrice">
                                </div>

                            </div>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">剩余库存</label>
                                <div class="col-sm-4">
                                    <input class="form-control" name="stockNum">
                                </div>

                            </div>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">支付方式</label>
                                <div class="col-sm-2" id="reface">
                                    <input id="one_box" type="checkbox" name="saleType" value="0" checked>积分
                                    <input id="two_box" style="margin-left: 20px" type="checkbox" name="saleType" value="1">余额
                                </div>
                                                            <span>至少选择一种支付方式</span>
                            </div>

                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">商品缩略图</label>
                                <%--                            <a id="contractFile" href="#"></a>--%>
                                <%--                            <input  type="hidden" id="fileName" name="fileName" value="">--%>
                                <a id="coman"
                                   style="border-radius: 6px;background: #ccc; color: white; width:100px;margin-left: 15px;position: relative;">
                                    <div style="position: absolute;left: 20px;top: 2px;" id="case">点击上传</div>
                                    <input type="file" style="width: 100px;opacity: 0" id="docfile" name="goodsImage_file"/>
                                </a>

                                <div style="color: gray;margin-left: 290px;">建议尺寸200px*200px,大小不超过1M,此图必选</div>
                            </div>

                            <div class="form-group row uploadBlock">
                                <label class="col-sm-4 col-form-label text-right">商品banner图</label>
                                <div class="line1">
                                    <a id="coman1"
                                       style="border-radius: 6px;background: #ccc; color: white; width:100px;margin-left: 15px;position: relative;">
                                        <div style="position: absolute;left: 14px;top: 0.4px;" id="case1">点击上传</div>
                                        <input type="file" style="width: 100px;opacity: 0;width: 80px;" id="docfile1"
                                               name="imageBroadcast1_file"/>
                                    </a>
                                    <a id="coman2"
                                       style="border-radius: 6px;background: #ccc; color: white; width:100px;margin-left: 15px;position: relative;">
                                        <div style="position: absolute;left: 14px;top: 0.4px;" id="case2">点击上传</div>
                                        <input type="file" style="width: 100px;opacity: 0;width: 80px;" id="docfile2"
                                               name="imageBroadcast2_file"/>
                                    </a>
                                </div>
                                <div class="line2" style="margin-left: 275px;">
                                    <a id="coman3"
                                       style="border-radius: 6px;background: #ccc; color: white; width:100px;margin-left: 15px;position: relative;">
                                        <div style="position: absolute;left: 14px;top: 0.4px;" id="case3">点击上传</div>
                                        <input type="file" style="width: 100px;opacity: 0;width: 80px;" id="docfile3"
                                               name="imageBroadcast3_file"/>
                                    </a>
                                    <a id="coman4"
                                       style="border-radius: 6px;background: #ccc; color: white; width:100px;margin-left: 15px;position: relative;">
                                        <div style="position: absolute;left: 14px;top: 0.4px;" id="case4">点击上传</div>
                                        <input type="file" style="width: 100px;opacity: 0;width: 80px;" id="docfile4"
                                               name="imageBroadcast4_file"/>
                                    </a>
                                </div>
                                <div class="line3" style="margin-left: 275px;">
                                    <a id="coman5"
                                       style="border-radius: 6px;background: #ccc; color: white; width:100px;margin-left: 15px;position: relative;">
                                        <div style="position: absolute;left: 14px;top: 0.4px;" id="case5">点击上传</div>
                                        <input type="file" style="width: 100px;opacity: 0;width: 80px;" id="docfile5"
                                               name="imageBroadcast5_file"/>
                                    </a>
                                </div>
                                <%--                            <div class="col-sm-4">--%>
                                <%--                                <input class="form-control" name="memberRealName" id="memberRealName">--%>
                                <%--                            </div>--%>
                                <div style="color: gray;margin-left: 290px;">建议尺寸750px*320px，大小不超过1M，至少上传一张</div>
                            </div>


                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">商品详情图</label>
                                <a id="coman6"
                                   style="border-radius: 6px;background: #ccc; color: white; width:100px;margin-left: 15px;position: relative;">
                                    <div style="position: absolute;left: 20px;top: 2px;" id="case6">点击上传</div>
                                    <input type="file" style="width: 100px;opacity: 0" id="docfile6" name="imageDetail1_file"/>
                                </a>

                                <div style="color: gray;margin-left: 290px;">建议尺寸宽度750px,长度不限,大小不超过5M,至少上传一张</div>
                            </div>
                            <div class="form-group row">
                                <label class="col-sm-4 col-form-label text-right">商品介绍文字</label>
                                <div class="col-sm-3">
                                    <textarea id="contentf" placeholder="最多支持200个汉字" cols="40" rows="10" name="goodsContext"></textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-8 text-right" style="flex: 1 0 5%;">
                                    <button type="button" class="btn btn-primary close_btn"
                                            style="padding: 0.03rem 0.1rem">取消
                                    </button>
                                </div>
                                <div class="col-sm-4 col-sm-offset-8 text-right" style="flex: 0 0 5%;">
                                    <button type="submit" class="btn btn-primary" style="padding: 0.03rem 0.1rem">保存
                                    </button>
                                </div>
                                <div class="col-sm-4 col-sm-offset-8 text-right" style="flex: 0 0 5%;">
                                    <button type="button" class="btn btn-primary" style="padding: 0.03rem 0.1rem"
                                            onclick="frontsee()">预览
                                    </button>
                                </div>
                            </div>

                        </form>
                    </div>
                    <div class="content_right">
                        <div style="width: 350px;height: 557px;margin-top: 100px;border: 1px solid black">
                            <div style="width: 100%"><img style="width: 100%" src="${ctx}/statics/img/frontsee1.png"
                                                          alt=""></div>
                            <div style="width: 100%;height: 48px;font-size: 20px;font-weight: 400;color: #333333;text-align: center">
                                商品详情
                            </div>
                            <%--                               <div></div>--%>
                            <div class="swiper-container" style="width: 100%;height: 138px;">
                                <div class="swiper-wrapper" id="pigking">
                                    <%--                                       <div class="swiper-slide" style="background: red"><img src="" alt=""></div>--%>
                                    <%--                                       <div class="swiper-slide" style="background: orange">slider2</div>--%>
                                    <%--                                       <div class="swiper-slide" style="background: yellow">slider3</div>--%>
                                    <%--                                       <div class="swiper-slide" style="background: green">slider4</div>--%>
                                    <%--                                       <div class="swiper-slide" style="background: blue">slider5</div>--%>
                                </div>
                                <div class="swiper-pagination"></div>
                            </div>
                            <div style="width: 100%;height: 50px">
                                <div style="width: 100%;margin-top: 3px;">
                                    <div id="shopnamed"
                                         style="color:#333;font-weight: bolder;width: 90%;margin-left: 5%;font-size: 20px"></div>
                                </div>
                                <div style="width: 100%;margin-top: 3px;color: #333;">
                                    <div id="dj"
                                         style="width:56%;font-size: 19px;color: red;display: inline-block;margin-left: 5%;vertical-align: bottom;"></div>
                                    <div id="dj2"
                                         style="display: inline-block;margin-left: 10%;height: 50%;vertical-align: bottom;color: #CCCCCC;font-size: 14px;opacity: 0;">
                                        已兑换XXX份
                                    </div>
                                </div>
                            </div>
                            <div style="width: 100%;height: 50px;margin-top: 3%;overflow: auto;">
                                <%--                                   overflow: auto;--%>
                                <div id="fcontent" style="width: 90%;margin-left: 5%"></div>
                            </div>
                            <div style="height: 30px;width: 100%;">
                                <div id="dj3"
                                     style="height: 30px;margin-top: 8px;margin-left: 5%;font-size: 17px;font-weight: bolder;color: black;opacity: 0;">
                                    图文详情
                                </div>
                            </div>
                            <div style="width: 100%;height: 140px; overflow-y: auto">
                                <img id="detailMap" src="" alt="">
                            </div>
                            <div style="width: 100%;margin-top: 3%">
                                <div id="dj4"
                                     style="margin-left:5%;width: 30%;height: 32px;background: linear-gradient(180deg,#ffd82c, #edb504);border-radius: 10px;display: inline-block;color: white;text-align: center;line-height: 32px;opacity: 0;">

                                </div>
                                <div id="dj5"
                                     style="margin-left:5%;width: 54%;height: 32px;background: linear-gradient(180deg,#f96c50, #d9044c);border-radius: 10px;display: inline-block;color: white;text-align: center;vertical-align: top;line-height: 32px;opacity: 0;">
                                    积分兑换
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
<script>

    var mySwiper = new Swiper('.swiper-container', {
        autoplay: false,
        // autoplayDisableOnInteraction : false,
        // loop: true,
        direction: 'horizontal',
        // pagination : '.swiper-pagination',
        // paginationClickable: true,
        touchRatio: 0.5,
        autoHeight: true,
        observer: true,//修改swiper自己或子元素时，自动初始化swiper
        observeParents: true,//修改swiper的父元素时，自动初始化swiper

    });
    var mySwiper1 = new Swiper('.swiper-container', {
        autoplay: 3000,
        // autoplayDisableOnInteraction : false,
        loop: true,
        direction: 'horizontal',
        // pagination : '.swiper-pagination',
        paginationClickable: true,
        touchRatio: 0.5,
        autoHeight: true,
        observer: true,//修改swiper自己或子元素时，自动初始化swiper
        observeParents: true,//修改swiper的父元素时，自动初始化swiper

        //分页器
        pagination: '.swiper-pagination',
    });


    $('#docfile').on('change', function () {
        // alert(a);
        var aa = document.getElementById("docfile").value.toLowerCase().split('.');
        if (document.getElementById("docfile").value != "") {
            if (aa[aa.length - 1] == 'gif' || aa[aa.length - 1] == 'jpg' || aa[aa.length - 1] == 'bmp' || aa[aa.length - 1] == 'png' || aa[aa.length - 1] == 'jpeg') {

            } else {
                layer.alert('请上传图片格式');
                return false;
            }
        }
        var fileSize = $(this)[0].files[0].size;
        if (fileSize > (1 * 1024 * 1024)) {
            layer.msg('请上传小于1M的图片！');
            $("#docfile").val("");
            return
        }
        if ($('#docfile').val().length != 0) {
            // alert($('#coman').css('background-color'))
            if ($('#coman').css('background-color') == 'rgb(204, 204, 204)') {
                // alert(1)
                $('#coman').after('<button id="new_bt" type="button" style="width: 19px;height: 19px;border-radius: 50%;background:#ccc; border: none;margin-left: 10px;" onclick="reseten()"><img src="${ctx}/statics/img/x.png"></button>');

            }
            $('#coman').css('background-color', '#51adcc');
            $('#case').html('上传成功');
            // alert(a);

        }
    })
    $('#docfile1').on('change', function () {
        var bb = document.getElementById("docfile1").value.toLowerCase().split('.');
        if (document.getElementById("docfile1").value != "") {
            if (bb[bb.length - 1] == 'gif' || bb[bb.length - 1] == 'jpg' || bb[bb.length - 1] == 'bmp' || bb[bb.length - 1] == 'png' || bb[bb.length - 1] == 'jpeg') {

            } else {
                layer.alert('请上传图片格式');
                return false;
            }
        }
        var fileSize = $(this)[0].files[0].size;
        if (fileSize > (1 * 1024 * 1024)) {
            layer.msg('请上传小于1M的图片！');
            $("#docfile1").val("");
            return
        }
        if ($('#docfile1').val().length != 0) {
            if ($('#coman1').css('background-color') == 'rgb(204, 204, 204)') {
                $('#coman1').after('<button id="new_bt1" type="button" style="width: 19px;height: 19px;border-radius: 50%;background:#ccc; border: none;margin-left: 10px;" onclick="reseten1()"><img src="${ctx}/statics/img/x.png"></button>');

            }
            $('#coman1').css('background-color', '#51adcc');
            $('#case1').html('上传成功');

        }
    })
    $('#docfile2').on('change', function () {
        var aa = document.getElementById("docfile2").value.toLowerCase().split('.');
        if (document.getElementById("docfile2").value != "") {
            if (aa[aa.length - 1] == 'gif' || aa[aa.length - 1] == 'jpg' || aa[aa.length - 1] == 'bmp' || aa[aa.length - 1] == 'png' || aa[aa.length - 1] == 'jpeg') {

            } else {
                layer.alert('请上传图片格式');
                return false;
            }
        }
        var fileSize = $(this)[0].files[0].size;
        if (fileSize > (1 * 1024 * 1024)) {
            layer.msg('请上传小于1M的图片！');
            $("#docfile2").val("");
            return
        }
        if ($('#docfile2').val().length != 0) {
            if ($('#coman2').css('background-color') == 'rgb(204, 204, 204)') {
                $('#coman2').after('<button id="new_bt2" type="button" style="width: 19px;height: 19px;border-radius: 50%;background:#ccc; border: none;margin-left: 10px;" onclick="reseten2()"><img src="${ctx}/statics/img/x.png"></button>');

            }
            $('#coman2').css('background-color', '#51adcc');
            $('#case2').html('上传成功');

        }
    })
    $('#docfile3').on('change', function () {
        var aa = document.getElementById("docfile3").value.toLowerCase().split('.');
        if (document.getElementById("docfile3").value != "") {
            if (aa[aa.length - 1] == 'gif' || aa[aa.length - 1] == 'jpg' || aa[aa.length - 1] == 'bmp' || aa[aa.length - 1] == 'png' || aa[aa.length - 1] == 'jpeg') {

            } else {
                layer.alert('请上传图片格式');
                return false;
            }
        }
        var fileSize = $(this)[0].files[0].size;
        if (fileSize > (1 * 1024 * 1024)) {
            layer.msg('请上传小于1M的图片！');
            $("#docfile3").val("");
            return
        }
        if ($('#docfile3').val().length != 0) {
            if ($('#coman3').css('background-color') == 'rgb(204, 204, 204)') {
                $('#coman3').after('<button id="new_bt3" type="button" style="width: 19px;height: 19px;border-radius: 50%;background:#ccc; border: none;margin-left: 10px;" onclick="reseten3()"><img src="${ctx}/statics/img/x.png"></button>');

            }
            $('#coman3').css('background-color', '#51adcc');
            $('#case3').html('上传成功');

        }
    })
    $('#docfile4').on('change', function () {
        var aa = document.getElementById("docfile4").value.toLowerCase().split('.');
        if (document.getElementById("docfile4").value != "") {
            if (aa[aa.length - 1] == 'gif' || aa[aa.length - 1] == 'jpg' || aa[aa.length - 1] == 'bmp' || aa[aa.length - 1] == 'png' || aa[aa.length - 1] == 'jpeg') {

            } else {
                layer.alert('请上传图片格式');
                return false;
            }
        }
        var fileSize = $(this)[0].files[0].size;
        if (fileSize > (1 * 1024 * 1024)) {
            layer.msg('请上传小于1M的图片！');
            $("#docfile4").val("");
            return
        }
        if ($('#docfile4').val().length != 0) {
            if ($('#coman4').css('background-color') == 'rgb(204, 204, 204)') {
                $('#coman4').after('<button id="new_bt4" type="button" style="width: 19px;height: 19px;border-radius: 50%;background:#ccc; border: none;margin-left: 10px;" onclick="reseten4()"><img src="${ctx}/statics/img/x.png"></button>');

            }
            $('#coman4').css('background-color', '#51adcc');
            $('#case4').html('上传成功');

        }
    })
    $('#docfile5').on('change', function () {
        var aa = document.getElementById("docfile5").value.toLowerCase().split('.');
        if (document.getElementById("docfile5").value != "") {
            if (aa[aa.length - 1] == 'gif' || aa[aa.length - 1] == 'jpg' || aa[aa.length - 1] == 'bmp' || aa[aa.length - 1] == 'png' || aa[aa.length - 1] == 'jpeg') {

            } else {
                layer.alert('请上传图片格式');
                return false;
            }
        }
        var fileSize = $(this)[0].files[0].size;
        if (fileSize > (1 * 1024 * 1024)) {
            layer.msg('请上传小于1M的图片！');
            $("#docfile5").val("");
            return
        }
        if ($('#docfile5').val().length != 0) {
            if ($('#coman5').css('background-color') == 'rgb(204, 204, 204)') {
                $('#coman5').after('<button id="new_bt5" type="button" style="width: 19px;height: 19px;border-radius: 50%;background:#ccc; border: none;margin-left: 10px;" onclick="reseten5()"><img src="${ctx}/statics/img/x.png"></button>');

            }
            $('#coman5').css('background-color', '#51adcc');
            $('#case5').html('上传成功');

        }
    })
    $('#docfile6').on('change', function () {
        var aa = document.getElementById("docfile6").value.toLowerCase().split('.');
        if (document.getElementById("docfile6").value != "") {
            if (aa[aa.length - 1] == 'gif' || aa[aa.length - 1] == 'jpg' || aa[aa.length - 1] == 'bmp' || aa[aa.length - 1] == 'png' || aa[aa.length - 1] == 'jpeg') {

            } else {
                layer.alert('请上传图片格式');
                return false;
            }
        }
        var fileSize = $(this)[0].files[0].size;
        if (fileSize > (5 * 1024 * 1024)) {
            layer.msg('请上传小于5M的图片！');
            $("#docfile6").val("");
            return
        }
        if ($('#docfile6').val().length != 0) {
            if ($('#coman6').css('background-color') == 'rgb(204, 204, 204)') {
                $('#coman6').after('<button id="new_bt6" type="button" style="width: 19px;height: 19px;border-radius: 50%;background:#ccc; border: none;margin-left: 10px;" onclick="reseten6()"><img src="${ctx}/statics/img/x.png"></button>');

            }
            $('#coman6').css('background-color', '#51adcc');
            $('#case6').html('上传成功');

        }
    })

    function reseten() {
        $('#docfile').val() == '';

        $('#case').html('点击上传');
        $('#coman').css('background-color', '#ccc');
        $('#new_bt').remove();

    }

    function reseten1() {
        $('#docfile1').val('');
        // console.log($('#docfile1').val());
        $('#case1').html('点击上传');
        $('#coman1').css('background-color', '#ccc');
        $('#new_bt1').remove();

    }

    function reseten2() {
        $('#docfile2').val('');
        $('#case2').html('点击上传');
        $('#coman2').css('background-color', '#ccc');
        $('#new_bt2').remove();

    }

    function reseten3() {
        $('#docfile3').val('');
        $('#case3').html('点击上传');
        $('#coman3').css('background-color', '#ccc');
        $('#new_bt3').remove();

    }

    function reseten4() {
        $('#docfile4').val('');
        $('#case4').html('点击上传');
        $('#coman4').css('background-color', '#ccc');
        $('#new_bt4').remove();

    }

    function reseten5() {
        $('#docfile5').val('');
        $('#case5').html('点击上传');
        $('#coman5').css('background-color', '#ccc');
        $('#new_bt5').remove();

    }

    function reseten6() {
        $('#docfile6').val('');
        $('#case6').html('点击上传');
        $('#coman6').css('background-color', '#ccc');
        $('#new_bt6').remove();

    }

    $('.close_btn').on('click', function (e) {
        e.preventDefault();
        var content = $(this).closest('div.ibox');
        content.remove();

        //返回上一页面
        window.history.back()
    });
    var num = 0;

    function frontsee() {
        //判断条件+
        // frontvalidate();
        if ($('#detailMap').attr('src') == '') {
            // alert(1)
            $('#detailMap').css('opacity', '0')
        }
        // alert($('#shopName').val().length)
        if ($('#shopName').val().length > 10) {
            // layer.msg('商品名称不能超过十个字');
            return false;
        }
        //预览
        $('#detailMap').css('width', '100%');
        $('#pigking').html("");

        // console.log($('#docfile1').files[0]);
        var piglet1 = document.getElementById('docfile1').files[0];
        // console.log(piglet1)
        var piglet2 = document.getElementById('docfile2').files[0];
        var piglet3 = document.getElementById('docfile3').files[0];
        var piglet4 = document.getElementById('docfile4').files[0];
        var piglet5 = document.getElementById('docfile5').files[0];
        var piglet6 = document.getElementById('docfile6').files[0];
        var obkUrl = getObjectURL(piglet6);
        $('#detailMap').attr('src', obkUrl);
        var str = '';
        $(".uploadBlock input[type='file']").each(function () {
            // console.log(11)
            if ($(this).val()) {
                var objUrl = getObjectURL(this.files[0]);//获取文件信息
                if (objUrl) {
                    str += "<div class='swiper-slide'>" + "<img src='" + objUrl + "' alt=''>" + "</div>"
                }
            }

        })
        //判断是否显示详情图
        if ($('#detailMap').attr('src') != '') {

            // alert(2)
            $('#detailMap').css('opacity', '1')
        }
        $('.swiper-wrapper').append(str);
        if ($(".swiper-slide").length > 1) {
            mySwiper1.init();
            $('.swiper-pagination').show()
            // flag = true
        } else {
            mySwiper.init();
            $('.swiper-pagination').hide()
        }

        // alert(flag);
        $('#shopnamed').html($('#shopName').val());
        $('#dj').html($('#UnitPrice').val() + '积分');
        $('#dj2').css('opacity', '1');
        $('#dj3').css('opacity', '1');
        $('#fcontent').html($('#contentf').val());
        $('#dj4').html('购买（' + $('#moneyPay').val() + '元）');
        $('#dj4').css('opacity', '1');
        $('#dj5').css('opacity', '1');
    }


    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) {
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
            // window.url.srcObject = file;
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }


</script>
<script type="text/javascript">
    // if(request.getSession(false)==null){
    //     // System.out.println("Session has been invalidated!");
    //     alert("session已过期")
    // }
    // else{
    //     // System.out.println("Session is active!");
    //     var sess = request.getSession(false);
    // }
    listTicketTypeId();

    function listTicketTypeId() {
        //查询可选优惠券输出
        $.get(jsctx + "/tenant/ticket/listAll", function (data) {
            var dataArray=data.data;
            if(dataArray!=null){
                var objectData=$("#ticketTypeId");
                for (var i = 0; i <dataArray.length ; i++) {
                    if(dataArray[i].discountType=='0'){
                        dataType = '满' + dataArray[i].useRequireAmount + '减' + dataArray[i].discountAmount;
                    }else{
                        dataType = '满' + dataArray[i].useRequireAmount +'享'+ dataArray[i].discount + '折';
                    }
                    objectData.append("<option value='"+dataArray[i].ticketTypeId+"' data-type='"+dataType+"'>"+dataArray[i].ticketName+"</option>")
                }
            }
        })
    };

    $("#ticketTypeId").change(function () {
        var type = ($(this).find("option:selected").attr("data-type"));
        $(".dataType").html(type)
    })

    addShoping.init();
</script>
</html>
